﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>WebAPI2的学习</title>
    <script src="~/scripts/jquery-1.10.2.js"></script>
    <script>
        $(function () {
            $("#btn1").click(function () {
                $.get("/Course/QueryCourse", { courseID: 88 }, function (data, status) {
                    alert(data);
                });
            });

            $("#btn2").click(function () {
                $.post("/Course/UpdateCourse", null, function (data, status) {
                    alert(data);
                });
            });

            $("#btn3").click(function () {
                $.post("/Course/DeleteCourse", { "": 888 }, function (data, status) {
                    alert(data);
                });
            });

            $("#btn4").click(function () {
                $.post("/Course/AddCourse", { Id: 123, Name: "WebAPI", Category: 8, Price: 100 }, function (data, status) {
                    alert(data);
                });
            });

            $("#btn5").click(function () {
                $.get("/api/Teacher", null, function (data, status) {
                    alert(data);
                });
            });

            $("#btn6").click(function () {
                $.post("/api/Teacher/QueryTeacherById", { "": 50 }, function (data, status) {
                    alert(data);
                });
            });

            $("#btn7").click(function () {
                $.get("/api/Teacher/GetCount", {age: 34}, function (data, status) {
                    alert(data);
                });
            });

            $("#btn8").click(function () {
                $.post("/api/Teacher/GetTeacherName", { "": 50 }, function (data, status) {
                    alert(data);
                });
            });

        });
       
    </script>
</head>
<body>
    <div> 
        <a href="/api/Course">1 简单测试WebAPI2</a><br />
        <a href="/api/Course/99">2 简单测试WebAPI2</a><br />
        <a href="/api/Course/99?courseID=99">3 简单测试WebAPI2</a><br />
        <a href="/Myapi/Course/getCourseByName/test">4 简单测试WebAPI2</a><br /><br />

        <input type="button" id="btn1" value="测试特性路由-Get"/><br /><br />
        <input type="button" id="btn2" value="测试特性路由-Post-无参数" /><br /><br />
        <input type="button" id="btn3" value="测试特性路由-Post-有一个参数" /><br /><br />
        <input type="button" id="btn4" value="测试特性路由-Post-有多个参数(实体对象)" /><br /><br />

        <input type="button" id="btn5" value="路由前缀-Get" /><br /><br />
        <input type="button" id="btn6" value="路由前缀-Post-有一个参数" /><br /><br />

        <input type="button" id="btn7" value="路由约束 1-Get" /><br /><br />
        <input type="button" id="btn8" value="路由约束 2-Post-有一个参数" /><br /><br />
    </div>
</body>
</html>
